import { getStore, removeStore, setStore } from '@/util/store'
import website from '@/const/website'
const disk = {

  state: {
    repository:{
      id:"",
      capacity: "0GB",
      maxCapacity: "50GB",
      tempCapacity: "0GB",
      percentage: 50
    },
    titleFolder:[{
      folderId: "1",
      folderName: "文件"

    }],
    showPreview: false,
    preview:{
      state:false,
      url:"http://127.0.0.1:8012/onlinePreview?url=aHR0cDovLzEyNy4wLjAuMTo4MDEyL2RlbW8v5bGP5bmV5oiq5Zu%2BIDIwMjEtMDgtMDQgMDk1MjE1LnBuZw%3D%3D",
      title: "标题"
    },
    searchData:{
      folderId: "1",
      folderName: "文件夹"
    },
    isLock: getStore({ name: 'isLock' }) || false
  },
  actions: {},
  mutations: {
    SET_TITLE_FOLDER:(state,active)=>{
      state.titleFolder = active;
      setStore({
        name: "titleFolder",
        content: state.titleFolder
      })
    },
    SET_REPOSITORY:(state,a)=>{
      state.repository =a;
      setStore({
        name: "repository",
        content: state.repository
      })
    },
    SET_PREVIEW:(state,active)=>{
      state.preview = active;
      setStore({
        name: "preview",
        content: state.preview
      })
    },
    SET_SHOW_PREVIEW:(state)=>{
      state.showPreview = !state.showPreview
    },
    CLEAR_LOCK: (state) => {
      state.isLock = false
      state.lockPasswd = ''
      removeStore({
        name: 'lockPasswd'
      })
      removeStore({
        name: 'isLock'
      })
    }
  }
}
export default disk
